% V20210224 - 16.3 GW APK Resource Management Example INCLUDE "GW.bas" % Make sure that the needed resources are on sdcard. IF IS_APK() MAKE_SURE_IS_ON_SD("cartman.png") MAKE_SURE_IS_ON_SD("whee.mp3") ENDIF % Create a page. p = GW_NEW_PAGE() % Now load the resources. AUDIO.LOAD whee, "whee.mp3" IF !whee THEN END GETERROR$() % something bad happened cartman = GW_ADD_ICON(p, "cartman.png", 24, 24) % Prepare title bar string. lbtn$ = GW_ADD_BAR_LBUTTON$(GW_ICON$(cartman) + ">WHEE") title$ = GW_ADD_BAR_TITLE$("GW APK demo") % Add title to page. GW_ADD_TITLEBAR(p, lbtn$ + title$) % Add a title. e$ = "APK mode: " IF IS_APK() THEN e$ += "enabled" ELSE e$ += "disabled" GW_ADD_TITLE(p, e$) % Add a text and a button GW_ADD_TEXT(p, "Tap Cartman to hear something.") GW_ADD_BUTTON(p, "Exit demo", "BACK") % Render the page GW_RENDER(p) DO % Wait for user action. r$ = GW_WAIT_ACTION$() % Place here any necessary code to process user actions. % Example feedback. IF r$ = "WHEE" THEN AUDIO.STOP : AUDIO.PLAY whee % End when BACK key is pressed. UNTIL r$ = "BACK" IF IS_APK() THEN EXIT ELSE END "End of GW APK demo."